home *** CD-ROM | disk | FTP | other *** search
- /*
- * $RCSfile: dumpStats.C,v $
- * $Revision: 1.1.1.1 $
- * $Date: 1996/05/04 21:56:03 $
- */
- /**********************************************************************
- * EXODUS Database Toolkit Software
- * Copyright (c) 1991 Computer Sciences Department, University of
- * Wisconsin -- Madison
- * All Rights Reserved.
- *
- * Permission to use, copy, modify and distribute this software and its
- * documentation is hereby granted, provided that both the copyright
- * notice and this permission notice appear in all copies of the
- * software, derivative works or modified versions, and any portions
- * thereof, and that both notices appear in supporting documentation.
- *
- * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
- * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.
- * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
- * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
- *
- * The EXODUS Project Group requests users of this software to return
- * any improvements or extensions that they make to:
- *
- * EXODUS Project Group
- * c/o David J. DeWitt and Michael J. Carey
- * Computer Sciences Department
- * University of Wisconsin -- Madison
- * Madison, WI 53706
- *
- * or exodus@cs.wisc.edu
- *
- * In addition, the EXODUS Project Group requests that users grant the
- * Computer Sciences Department rights to redistribute these changes.
- **********************************************************************/
-
- #include "sysdefs.h"
- #include "ess.h"
- #include "checking.h"
- #include "trace.h"
- #include "error.h"
- #include "io.h"
- #include "list.h"
- #include "tid.h"
- #include "lock.h"
- #include "object.h"
- #include "msgdefs.h"
- #include "thread.h"
- #include "semaphore.h"
- #include "link.h"
- #include "lsn.h"
- #include "latch.h"
- #include "bf.h"
- #include "volume.h"
- #include "trans.h"
- #include "bitvec.h"
- #include "openlog.h"
- #include "msgvector.h"
- #include "adminmsg.h"
- #include "msg_funcs.h"
- #include "thread_funcs.h"
- #include "server_util_funcs.h"
- #include "thread_globals.h"
- #include "msg_globals.h"
- #include "log_globals.h"
- #include "admin_globals.h"
- #include "stat_globals.h"
- #include "queue_consist.h"
- #include "timer.h"
-
- extern int NumBuffers; /* ../bf/space.c */
- #if IO_STATISTICS IS_ENABLED
- extern int IO_DiskReads, IO_DiskWrites; /* ../io/space.c */
- #endif
-
- void
- dumpStats()
- {
-
- /*
- * Print server statistics collected by the admin facility
- */
- fprintf(stdout,"Number of Clients: %d, Number of Volumes: %d\n", ServerStats.numClients, ServerStats.numVolumes);
- fprintf(stdout,"Transactions in progress: %d, Total Commits: %d, Total Aborts: %d\n",
- ServerStats.numTrans, ServerStats.totalCommits, ServerStats.totalAborts);
- fprintf(stdout,"Total disk reads: %d, Total disk writes: %d\n",
- ServerStats.diskReads, ServerStats.diskWrites);
- fprintf(stdout,"Free Log Space: %d, Checkpoint Freq: %d\n",
- ServerStats.freeLogSpace, ServerStats.chpntFreq);
- fprintf(stdout,"\n");
- #ifdef DEBUG
- fprintf(stderr, "Largest stack used: %d words.\n", LargestStack);
- #endif DEBUG
-
- #ifdef DEBUG
- {
- extern int loops, loop_spare, loop_ran_ready;
-
- fprintf(stdout,"LOOPS: %d loops, %d spare, %d ran_ready, %d selects\n",
- loops, loop_spare, loop_ran_ready,
- loops-(loop_spare+loop_ran_ready
- +disk_replies_found
- ));
- }
- #endif DEBUG
- if(serv_sleeps + serv_sel_intrs == 0) {
- fprintf(stdout,"NO SELECTS\n");
- } else {
- fprintf(stdout,
- "SELECTS: %d, %d EINTR, %d connect, %d disk, %d client, %d stdin, %d media, %d dgram\n",
- serv_sleeps, serv_sel_intrs,
- sel_connects, sel_disks, sel_clients, sel_stdin, sel_media,
- sel_dgrams);
- fprintf(stdout,"REPLIES (from SELECT.disk):\n");
- fprintf(stdout," %d replies kicked,", disk_replies_kicked);
- fprintf(stdout," %d replies found,", disk_replies_found);
- fprintf(stdout," %d unnecessary kicks\n", unnecessary_kicks);
- fprintf(stdout,"CACHE (from SELECT.client) : %d buffers\n", NumBuffers);
- fprintf(stdout," %d hits, %d misses\n", cache_hits, cache_misses);
- }
-
- #if IO_STATISTICS IS_ENABLED
- fprintf(stdout," %d IO_DiskReads, %d IO_DiskWrites\n", IO_DiskReads, IO_DiskWrites);
- fprintf(stdout,"DISK MESSAGES (from CACHE.IO_Disk{Read,Write}s):\n");
- #else
- fprintf(stdout,"DISK MESSAGES:\n");
- #endif IO_STATISTICS IS_ENABLED
-
- fprintf(stdout," %d requests, %d locally, %d remotely\n",
- disk_requests, fast_path_taken, slow_path_taken);
-
- fprintf(stdout,"QUEUES (from DISK MESSAGES.remotely):\n");
- fprintf(stdout," %d outstanding disk requests,", disk_requests_out);
- fprintf(stdout," %d waiting to write to q,", threads_awaiting_q);
- fprintf(stdout," %d V semaphore ops\n", serv_v_ops);
-
- #ifdef TIME_CALLDISK
- {
- extern int avgcount;
- register int i, sum, usum;
- extern struct timeval hist[], avghist;
- fprintf(stdout,"last 50 times for callDisk (from DISK MESSAGES.remotely):\n");
- sum = usum = 0;
- for(i=0; i<10; i++) {
- sum += hist[i].tv_sec; usum += hist[i].tv_usec;
- sum += hist[i+10].tv_sec; usum += hist[i+10].tv_usec;
- sum += hist[i+20].tv_sec; usum += hist[i+20].tv_usec;
- sum += hist[i+30].tv_sec; usum += hist[i+30].tv_usec;
- sum += hist[i+40].tv_sec; usum += hist[i+40].tv_usec;
- fprintf(stdout,
- "%3.3d.%6.6d %3.3d.%6.6d %3.3d.%6.6d %3.3d.%6.6d %3.3d.%6.6d\n",
- hist[i].tv_sec, hist[i].tv_usec,
- hist[i+10].tv_sec, hist[i+10].tv_usec,
- hist[i+20].tv_sec, hist[i+20].tv_usec,
- hist[i+30].tv_sec, hist[i+30].tv_usec,
- hist[i+40].tv_sec, hist[i+40].tv_usec
- );
- }
- fprintf(stdout, "AVG: last 50: %3.3d.%6.6d, all: %3.3d.%6.6d\n",
- sum/50, usum/50, avghist.tv_sec/avgcount, avghist.tv_usec/avgcount);
- }
- #endif TIME_CALLDISK
-
- if( itx_lrc_lookups > 0) {
- fprintf(stdout,
- "INTER TRANSACTION PAGE CACHING: %d {PID,LRC} lookups, %d PID finds\n",
- itx_lrc_lookups, itx_lrc_finds );
- fprintf(stdout,
- "\t%d out-of-date LRCs, %d page sends skipped (w/ %d disk reads)\n",
- itx_client_old, itx_client_current, itx_server_foiled);
- }
-
- printMessageStats(stdout, &MsgStats);
-
- ServerTimer.PrintStats();
- } /* dumpStats */
-
- void
- clearStats()
- {
- itx_client_current = itx_client_old = itx_server_foiled = 0;
- itx_lrc_lookups = itx_lrc_finds = 0;
-
- cache_hits = cache_misses =0;
- #if IO_STATISTICS IS_ENABLED
- IO_DiskReads = IO_DiskWrites = 0;
- #endif
- fast_path_taken = slow_path_taken = disk_requests = 0;
- serv_sleeps = serv_sel_intrs = 0;
- sel_connects = sel_disks = sel_clients = sel_stdin = sel_media =
- sel_dgrams = 0;
-
- serv_v_ops = 0;
- disk_replies_found = disk_replies_kicked = unnecessary_kicks = 0;
- /* DO NOT TOUCH disk_requests_out, threads_awaiting_q -- they are not
- * merely stats
- */
- { /* TODO: remove */
- extern int loops, loop_spare, loop_ran_ready;
-
- loops = loop_spare = loop_ran_ready =0;
- }
-
- (void) BZERO(&MsgStats, sizeof(MsgStats));
- }
-
-